﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
//定义一个结构体，名为PersonStruct，有三个成员变量：姓名、电话、地址，
//在主方法中，创建一个PersonStruct结构体对象p1，为p1的成员变量赋值。
//再声明一个PersonStruct结构体变量p2，把p1赋值给p2，改变p2的姓名，打印p1的内容。

//定义一个类，名为PersonClass，有三个成员变量：姓名、电话、地址，
//在主方法中，创建一个PersonClass对象p3，为p3的成员变量赋值。
//再声明一个PersonClass变量p4，把p3赋值给p4，改变p4的姓名，打印p3的内容。
namespace ConsoleApp1
{struct PersonStruct
    {
        public string name;
        public int phone;
        public string address;
    }
    class Program
    {
        static void Main(string[] args)
        {
            PersonStruct p1 = new PersonStruct();
            p1.address = "福建";
            p1.name = "李强";
            p1.phone = 123456789;
            Console.WriteLine(p1.address + "--" + p1.name + "--" + p1.phone);
            PersonStruct p2 = new PersonStruct();
            p2 = p1;
            p2.address = "福建";
            p2.name = "张三";
            p2.phone = 123456789;
            Console.WriteLine(p1.address + "--" + p1.name + "--" + p1.phone);

            PersonClass p3 = new PersonClass();
            p3.address = "福建";
            p3.name = "王五";
            p3.phone = 123456789;
            Console.WriteLine(p3.address + "--" + p3.name + "--" + p3.phone);

            PersonClass p4 = new PersonClass();
            p3 = p4;
            p4.address = "福建";
            p4.name = "李达";
            p4.phone = 123456789;
            Console.WriteLine(p3.address + "--" + p3.name + "--" + p3.phone);
        }
    }
}
